www.mxdraw.com
|
与用户交互到在图上提取一个点
[helpstring("method GetPoint")] HRESULT GetPoint([in] IMxDrawPoint* point, [in] BSTR prompt, [out,retval] IMxDrawPoint** pPoint);
参数 |
说明 |
[in] IMxDrawPoint* point |
交互提取时,前一个参考点,可以传为null |
[in] BSTR prompt |
命令提示字符串 |
返回提取到的点,返回null表示没成功得到点
例如: Delphi中取一个点的例程代码
procedure TForm1.DoInsertFlagClick(); var ptInsert : OleVariant; pt : IMxDrawPoint ; begin ptInsert := mxUtility.GetPoint(EmptyParam,'点插入点'); pt:=IMxDrawPoint(IDisPatch(ptInsert)); if pt = nil then EXIT; MxDrawX1.InsertBlock(MxDrawX1.GetOcxAppPath() + 'blkTsgNote.dwg','Flag'); MxDrawX1.DrawBlockReference(pt.Get_x(),pt.Get_y(),'Flag',10.0,0.0); end;
例如: C# 求两点距离
MxDrawUtility mxUtility = new MxDrawUtility(); MxDrawPoint point = (MxDrawPoint)(mxUtility.GetPoint(null, "点取第一点:") ); if (point == null) { MessageBox.Show("用户取消.."); return; } MxDrawPoint point2 = (MxDrawPoint)(mxUtility.GetPoint(point, "点取第二点:")); if (point2 == null) { MessageBox.Show("用户取消.."); return; } Double dDis = Math.Sqrt((point.x - point2.x) * (point.x - point2.x) + (point.y - point2.y) * (point.y - point2.y)); MessageBox.Show("两点距离:" + dDis.ToString());